<template>
	<view class="content">
		
		<view class="borderBox">
			<view class="name">+86</view>
			<input class="inputBox" v-model="data.tel" type="number" maxlength="11" placeholder="请输入手机号">
		</view>
		<view class="borderBox">
			<view class="name">姓名</view>
			<input class="inputBox" v-model="data.name" type="text" placeholder="请输入姓名">
		</view>
		<view class="borderBox">
			<view class="name">职业</view>
			<input class="inputBox" v-model="data.job" type="text" placeholder="请输入职业">
		</view>
		<view class="splite"></view>
		
		<view class="title">上传身份证正反面</view>
		<view class="imageBox">
			<image class="image" :src="data.imageFace" mode="" @tap="changeImage(1)"></image>
			<image class="image" :src="data.imageBack" mode="" @tap="changeImage(2)"></image>
		</view>
		<view class="littleTitle fontSize12">*仅用于平台资质审核，以及招标方决策参考，不公开显示。</view>
		<view class="splite"></view>
		
		
		<view class="title">上传营业执照</view>
		<view class="imageBoxs" v-show="data.newJob==''">
			<image class="image" :src="data.imageJob" mode="" @tap="changeImage(3)"></image>
		</view>
		<image class="images" :src="data.newJob" mode="" @tap="changeImage(3)" v-show="data.newJob"></image>
		<view class="littleTitle fontSize12">**仅用于平台资质审核，以及招标方决策参考，不公开显示。</view>
		<view class="splite"></view>
		
		<view class="title">申请说明</view>
		<textarea class="textareaBox" v-model="data.textarea" placeholder="请输入申请说明~300字以内" />
		
		<view class="btnSure" @tap="btnSure">提交审核</view>
		
		
		
	</view>
</template>
<style>
	.content{padding-bottom: 40upx;}
	.content .borderBox{width: 90%;height:80upx;line-height: 80upx;margin-left: 5%;border-radius: 10upx;border:2upx solid #EEEEEE;display: flex;justify-content: space-between;margin-top: 20upx;}
	.content .borderBox .name{width: 20%;padding-left: 5%;font-size:28upx;color:#30313B}
	.content .borderBox .inputBox{width: 80%;height:80upx;line-height: 80upx;font-size:28upx;color:#30313B}
	.content .splite{width: 100%;height:20upx;background: rgb(245,245,249);margin-top: 40upx;}
	.content .title{color:#262626;font-size: 30upx;margin:40upx 0 20upx 5%;}
	.content .imageBox{width:90%;margin-left: 5%;display: flex;justify-content:space-between}
	.content .imageBox .image{width: 320upx;height:226upx;}
	.content .imageBoxs{width:90%;height:400upx;margin-left: 5%;border-radius: 10upx;display: flex;justify-content:center;align-items: center;background: rgb(245,245,249);}
	.content .imageBoxs .image{width: 150upx;height:150upx;}
	.content .images{width:90%;height:400upx;margin-left: 5%;border-radius: 10upx;}
	.content .littleTitle{color:#CED3DD;margin:20upx 0 0 5%}
	.content .textareaBox{width:80%;padding: 5%;height:240upx;margin-left: 5%;border-radius: 10upx;border:2upx solid #EEEEEE;}
	.content .btnSure{width: 90%;padding:25upx 0;margin-left: 5%;text-align: center;color:white;background: #DC582A;border-radius: 100upx;}
</style>
<script>
	import Share from '@/common/wx_share.js'
	export default {
		data() {
			return {
				share:{
					title:"",
					path:'/pages/tabbar/index',
					imageUrl:'',
					desc:'',
					content:''
				},
				data:{
					imageFace:"/pages_mine/pages/static/storeEntry/icon_2.png",
					imageBack:"/pages_mine/pages/sstatic/storeEntry/icon_1.png",
					imageJob:"/pages_mine/pages/static/storeEntry/icon_3.png",
					job:"",
					newJob:"",
					textarea:"",
					tel:"",
					name:""
				},
				imageSrc:"",
				imageToken:"",
				
				
				
				
				
				
			}
		},
		onLoad(){
			this.AjaxLoad()
			this.AjaxGetToken()
		},
		methods: {
			AjaxGetToken(){
				let param={
					token:this._$userToken("userInfo").token
				};
				this._$InitRequest.request('index/get_token', param).then(res => {
					this.imageToken = res.data.token
					this.imageSrc = res.data.domain + "/"
				},error=>{})
			},
			AjaxLoad(){
				let param={
					token:this._$userToken("userInfo").token,
				};
				this._$InitRequest.request("apply_info/applystatus", param).then(res => {
					if( res.data.zhuangtai == 1 || res.data.zhuangtai == 5 ){
						uni.showToast({icon:"none",title:res.data.xinxi})
						setTimeout(function(){
							uni.switchTab({
								url:"/pages/tabbar/index"
							})
						},1500)
					}else if( res.data.zhuangtai == 6 ){
						uni.showToast({icon:"none",title:res.data.xinxi})
					}
				},error=>{})
			},
			changeImage(e){
				var that = this;
				if( e == 1 ){
					uni.chooseImage({
					    count: 1,
					    sizeType: ['original', 'compressed'],
					    sourceType: ['album'],
					    success: function (res) {
							uni.uploadFile({
								url:"https://upload.qiniup.com",
								// header:{"content-type":"multipart/form-data"},
								filePath:res.tempFilePaths[0],
								name: 'file',
								formData: {
									'token':that.imageToken
								},
								success: (res) => {
									that.data.imageFace = that.imageSrc + JSON.parse( res.data ).key
								},
							});
					    }
					});
				}else if( e == 2 ){
					uni.chooseImage({
					    count: 1,
					    sizeType: ['original', 'compressed'],
					    sourceType: ['album'],
					    success: function (res) {
							uni.uploadFile({
								// url:"https://up-z2.qbox.me",
								// url:"https://upload-z2.qiniup.com",
								url:"https://upload.qiniup.com",
								// header:{"content-type":"multipart/form-data"},
								filePath:res.tempFilePaths[0],
								name: 'file',
								formData: {
									'token':that.imageToken
								},
								success: (res) => {
									that.data.imageBack = that.imageSrc + JSON.parse( res.data ).key
								},
							});
					    }
					});
				}else if( e == 3 ){
					uni.chooseImage({
					    count: 1,
					    sizeType: ['original', 'compressed'],
					    sourceType: ['album'],
					    success: function (res) {
							uni.uploadFile({
								// url:"https://up-z2.qbox.me",
								// url:"https://upload-z2.qiniup.com",
								url:"https://upload.qiniup.com",
								// header:{"content-type":"multipart/form-data"},
								filePath:res.tempFilePaths[0],
								name: 'file',
								formData: {
									'token':that.imageToken
								},
								success: (res) => {
									that.data.newJob = that.imageSrc + JSON.parse( res.data ).key
								},
							});
					    }
					});
				}
			},
			btnSure(){
				this.data.imageFace = this.data.imageFace.split(this.imageSrc)[1]
				this.data.imageBack = this.data.imageBack.split(this.imageSrc)[1]
				this.data.newJob = this.data.newJob.split(this.imageSrc)[1]
				let param={
					token:this._$userToken("userInfo").token,
					shop_desc:this.data.textarea,
					contacts:this.data.name,
					telephone:this.data.tel,
					profession:this.data.job,
					sfzz_pic:this.data.imageFace,
					sfzb_pic:this.data.imageBack,
					zhizhao:this.data.newJob,
				};
				this._$InitRequest.request('apply_info/apply', param).then(res => {
					uni.showToast({icon:"none",title:res.mess})
					if( res.status == 200 ){
						setTimeout(function(){
							uni.switchTab({
								url:"/pages/tabbar/index"
							})
						},1500)
					}
				},error=>{})
			},
			
			
		}
	}
</script>
<style lang="scss" scoped>
/deep/ .uni-input-input {font-size:32upx}
/deep/ .uni-radio-input-checked{background-color:rgb(110,43,34) !important;border:2upx solid white !important}
.content .html{
  ::v-deep {
    img {
      width: 100%;
    }
  }
}
</style>